<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 * Join_model short summary.
 *
 * Join_model description.
 *
 * @version 1.0
 * @author xianbin
 */
class Join_model extends CI_Model
{
    public $join_us_id;
    public $title;
    public $contents;
    public $menuid;
    public $description;
    public $keyword;
    public function __construct()
    {
        parent::__construct();
        $this->load->database();
    }

    public function add_join($joinModel)
    {
        return  $this->db->insert('join_us',$joinModel);
    }
    public function get_first_row_by_menuid($menuid)
    {
        $sql="select * from join_us where menuid=$menuid";
        return $this->db->query($sql)->row();
    }

    public function get_join_by_id($join_us_id)
    {
        $sql="select * from join_us where join_us_id=$join_us_id";
        return $this->db->query($sql)->row();
    }

    public function update_join($joinModel)
    {
        $sql="update join_us set title='$joinModel->title',contents='$joinModel->contents',description='$joinModel->description',keyword='$joinModel->keyword' where join_us_id=$joinModel->join_us_id";
        return $this->db->query($sql);
    }

    public function del_join($join_us_id)
    {
        $sql="delete from join_us where join_us_id=$join_us_id";
        return $this->db->query($sql);
    }
}